package com.potenza.ws.controller;

import com.potenza.ws.endpoint.ChatWebSocketEndPoint;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.websocket.Session;
import java.util.List;
import java.util.Map;
import java.util.Set;

@RestController
@RequestMapping("chat")
public class ChatController {


    @GetMapping("onlineUsers")
    public Set<String> getOnlineUsers() {
        Map<String, Session> userConnections = ChatWebSocketEndPoint.userConnections;

        return userConnections.keySet();
    }
}
